package com.yeming.flink.practice.transformation

import com.yeming.flink.practice.source.{MyCustomerSource, StationLog}
import org.apache.flink.streaming.api.scala._

object TranUnion {

  def main(args: Array[String]): Unit = {

    //环境设置
    val streamEnv: StreamExecutionEnvironment = StreamExecutionEnvironment.getExecutionEnvironment
    //设置并行度
//    streamEnv.setParallelism(1)
    //添加数据源
    val stream1: DataStream[(String, Int)] = streamEnv.fromElements(("a", 1), ("b", 3))
    val stream2: DataStream[(String, Int)] = streamEnv.fromElements(("a",4),("b",6))
    val stream3: DataStream[(String, Int)] = streamEnv.fromElements(("a",8),("b",10))
    //数据转换

    val result: DataStream[(String, Int)] = stream1.union(stream2,stream3)

    //数据sink
    result.print()
    //执行数据流
    streamEnv.execute("执行数据流转换")

  }

}
